<template>
  <div>
    <el-form :label-position="labelPosition" label-width="80px" :model="formLabelAlign">
      <el-form-item label="文章标题">
        <el-input v-model="formLabelAlign.title"></el-input>
      </el-form-item>
      <el-form-item label="文章内容">
        <el-input v-model="formLabelAlign.contents" type="textarea" :rows="23"></el-input>
      </el-form-item>

    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="reset('dataAddForm')">重置</el-button>

      <el-button type="primary" @click="handleAdd()">确定</el-button>

    </div>
  </div>
</template>

<script>
import axios from "axios";

export default {
  name: "ArticleAdd",

  data(){
    return{
      labelPosition: 'left',
      formData: {},
      formLabelAlign: {
        title: '',
        contents: '',

      }
    }
  },
  methods:{
    reset(){
      this.formLabelAlign = {}
    },
    //添加
    handleAdd () {
      axios.post("/article-service/insert", this.formLabelAlign).then(res => {
        // 判断当前操作是否成功
        if(res.data.flag) {
          this.$message.success(res.data.msg);
        } else {
          this.$message.error(res.data.msg);
        }
      });
    },
  },

}
</script>

<style scoped>

</style>